<template>
  
	<div id="account">

		<flexbox>
	      <flexbox-item>
	      	<div class="balance">
	      		<div class="l">账户余额</div>
	      		<div class="p">
	      			<inline-loading v-if="profitPrice.accountprice == undefined"></inline-loading>
	      			{{profitPrice.accountprice}}
	      		</div>
	      	</div>
	      </flexbox-item>
	    </flexbox>

	    <flexbox class="profit">
	      <flexbox-item>
	      	<div class="l" >今日收益</div>
		    <div class="p" >
		    	<inline-loading v-if="profitPrice.todayprice == undefined"></inline-loading>
		    	{{profitPrice.todayprice}}
		    </div>
		  </flexbox-item>
		  <flexbox-item>
            <div class="l" >昨日收益</div>
            <div class="p" >
            	<inline-loading v-if="profitPrice.yesterdayprice == undefined"></inline-loading>
            	{{profitPrice.yesterdayprice}}
            </div>
	      </flexbox-item>
	    </flexbox>

	    <flexbox class="mt10">
	    	<flexbox-item >
	    		<yd-cell-group>
			        <yd-cell-item @click.native="income" arrow>
			            <span slot="left">
			            	累计收益
			            	<span class="red h5 ml10">¥</span>
			            	<span class="red h3">{{profitPrice.incomeprice}}</span>
			            </span>
			        </yd-cell-item>
			        <!-- <yd-cell-item @click.native="preincome" arrow>
			            <span slot="left">
			            	预计收益
			            	<span class="red h5 ml10">¥</span>
			            	<span class="red h3">{{profitPrice.estimateprice}}</span>
			            </span>
			        </yd-cell-item> -->
			        <yd-cell-item @click.native="cashloglist" arrow>
			            <span slot="left">
			            	累计提现
			            	<span class="red h5 ml10">¥</span>
			            	<span class="red h3">{{profitPrice.outprice}}</span>
			            </span>
			        </yd-cell-item>
			    </yd-cell-group>

	    	</flexbox-item>
	    </flexbox>  

	    <!-- <flexbox>
	    	<flexbox-item >
	    		<yd-cell-group>
			        <yd-cell-item arrow>
			            <span slot="left">
			            	群盟帮助
			            </span>
			        </yd-cell-item>
			    </yd-cell-group>
	    	</flexbox-item>
	    </flexbox>   -->


	    <yd-button-group>
	        <yd-button @click.native="cash" size="large" type="primary" >提现</yd-button>
	    </yd-button-group>
	

	</div>


</template>

<script>

// import { Cell, MessageBox, Button, Popup} from 'mint-ui'
import { mapGetters } from 'vuex'
import { InlineLoading } from 'vux'

export default {
	name: 'Account',
	data () {
		return {
			msg: '账户。。。。。。',
		}
	},

	components: {
	    InlineLoading,
	},

	computed : {
		...mapGetters([
			'company_code',
			'userdata',
			'profitPrice',
			
		]),

	},


	created () {
		console.log('this.userdata');
		console.log(this.userdata);
		this.$store.dispatch('getProfitPrice', {
			'level_code' : this.userdata.level,
		});
	},


	methods : {
		income () {
			console.log('income');
			this.$router.push({ 
				'name': 'profitlist', 
				'params': { 
					'what': 'income',
				},
				'query' : { 
					'company_code' : this.company_code,
				}
			});
		},

		preincome () {
			this.$router.push({ 
				'name': 'profitlist', 
				'params': { 
					'what': 'preincome',
				},
				'query' : { 
					'company_code' : this.company_code,
				}
			});
		},

		cashloglist () {
			this.$router.push({ 
				'name': 'cashloglist', 
				'query' : { 
					'company_code' : this.company_code,
				}
			});
		},


		cash () {
			console.log('提现');

			this.$router.push({ 
				'name': 'cash', 
				'query' : { 
					'company_code' : this.company_code,
					'max_money' : this.profitPrice.accountprice,
				}
			});
		}
	}
}
</script>

<style scoped>

.balance {
	background-color: #fff;
	text-align: center;
	padding-top: 50px;
	padding-bottom: 10px;
}
.balance .l{
	color: #999;
}
.balance .p{
	font-size: 48px;
}

.profit {
	background-color: #fff;
	text-align: center;
	padding-top: 10px;
	padding-bottom: 10px;
}

.profit .l {
	color: #999;
	font-size: 12px;
}
.profit .p {
	font-size: 24px;
}
</style>
